import {
  createRouter,
  createWebHistory,
  createWebHashHistory,
  RouteRecordRaw,
} from "vue-router";
import HomeView from "../views/HomeView.vue";
import {
  Menu as IconMenu,
  Coin,
  Document,
  TrendCharts,
  Van,
} from "@element-plus/icons-vue";
const routes: Array<RouteRecordRaw> = [
  // {
  //   path: "/",
  //   name: "home",
  //   component: HomeView,
  // },
  // {
  //   path: "/about",
  //   name: "about",
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  // },
  {
    path: "/login",
    name: "login",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/login/LoginView.vue"),
  },
  {
    path: "/home",
    name: "home",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/home/HomePage.vue"),
    children: [
      {
        path: "/screen",
        name: "screen",
        component: () => import("../views/home/children/screen/ScreenView.vue"),
        meta: {
          title: "首页大屏",
          icon: TrendCharts,
        },
      },
      {
        path: "/echarts",
        name: "echarts",
        component: () => import("../views/home/children/EchartsView.vue"),
        meta: {
          title: "数据展示",
          icon: TrendCharts,
        },
      },
      {
        path: "/pay",
        name: "pay",
        component: () => import("../views/home/children/PayList/PayList.vue"),
        meta: {
          title: "缴费管理",
          icon: Coin,
        },
        children: [
          {
            path: "/property-pay",
            name: "property-pay;",
            component: () =>
              import("../views/home/children/PayList/property-pay.vue"),
            meta: {
              classifyTitle: "物业费",
              title: "水电物业费",
            },
          },

          {
            path: "/parking-pay",
            name: "parking-pay",
            component: () =>
              import("../views/home/children/PayList/parking-pay.vue"),
            meta: {
              classifyTitle: "停车缴费",
              title: "停车缴费",
            },
          },
        ],
      },
      {
        path: "/ParkingSpace",
        name: "ParkingSpace",
        component: () => import("../views/home/vehicle/VehicleManagement.vue"),
        meta: {
          title: "车位管理",
          icon: Van,
        },
        children: [
          {
            path: "/HouseholdVehicles",
            name: "HouseholdVehicles",
            component: () =>
              import("../views/home/vehicle/HouseholdVehicles.vue"),
            meta: {
              classifyTitle: "车位管理",
              title: "住户车辆表",
            },
          },
          {
            path: "/CompanyVehicles",
            name: "CompanyVehicles",
            component: () =>
              import("../views/home/vehicle/CompanyVehicles.vue"),
            meta: {
              classifyTitle: "车位管理",
              title: "公司车辆表",
            },
          },
          {
            path: "/ForeignVehicles",
            name: "ForeignVehicles",
            component: () =>
              import("../views/home/vehicle/ForeignVehicles.vue"),
            meta: {
              classifyTitle: "车位管理",
              title: "机动车出入表",
            },
          },
        ],
      },
      {
        path: "/usermsg",
        name: "usermsg",
        component: () => import("../views/home/children/UserMessage.vue"),
        meta: {
          title: "住户信息",
          icon: Document,
        },
        children: [
          {
            path: "/userlist",
            name: "userlist",
            component: () => import("../views/home/children/UserList.vue"),
            meta: {
              classifyTitle: "住户信息",
              title: "住户信息列表",
            },
          },
          {
            path: "/userupdate",
            name: "userupdate",
            component: () => import("../views/home/children/UserUpdate.vue"),
            meta: {
              classifyTitle: "住户信息",
              title: "住户信息修改",
            },
          },
          {
            path: "/UserSurvey",
            name: "UserSurvey",
            component: () => import("../views/home/children/UserSurvey.vue"),
            meta: {
              classifyTitle: "住户信息",
              title: "住户信息概览",
            },
          },
        ],
      },
      {
        path: "/warehouseBox",
        name: "/warehouseBox",
        component: () => import("../views/warehouse/warehouseBox.vue"),
        meta: {
          title: "仓库管理",
          icon: TrendCharts,
        },
        children: [
          {
            path: "/warehouseTwo",
            name: "/warehouseTwo",
            component: () => import("../views/warehouse/warehouseTwo.vue"),
            meta: {
              classifyTitle: "物流仓库信息",
              title: "仓库管理员",
            },
          },
        ],
      },
    ],
  },
  {
    path: "/",
    redirect: "/login",
  },
];

const router = createRouter({
  history: createWebHashHistory(process.env.BASE_URL),
  routes,
});

export default router;
